<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script src='resources/shadow-dom.js'></script>
<script id='document-script'>
test(() => {
  assert_equals(document.currentScript, document.querySelector('#document-script'));
}, "document.curentScript in a document tree should return the script element");
</script>
<div id='host1'>
  <template data-mode='open'>
    <script>
      test(() => {
        assert_true(document.currentScript == null);
      }, "document.curentScript in an open shadow tree should return null");
    </script>
  </template>
</div>
<div id='host2'>
  <template data-mode='closed'>
    <script>
      test(() => {
        assert_true(document.currentScript == null);
      }, "document.curentScript in a closed shadow tree should return null");
    </script>
  </template>
</div>
<script>
convertTemplatesToShadowRootsWithin(host1);
convertTemplatesToShadowRootsWithin(host2);
</script>
